<?php

namespace Contact;

use Application\ControllerAbstract;

class Controller extends ControllerAbstract
{
    public function getConfig()
    {
        return include(__DIR__ . '/config/module.config.php');
    }

    public function indexAction()
    {
        $model = new Model();
        $form = $this->getForm(__NAMESPACE__ . '\\');
        $multiCheckbox = $form->getElement('service');
        $multiCheckbox->setOptions(['multiOptions' => $model->getServiceList()]);
        if ($this->isValidForm($form)) {
            $model->insert($form->getValues());
            $this->redirect('contact/thanks.html');
        }
        return [
            'formHtml' => $form->render()
        ];
    }

    public function thanksAction()
    {
    }
}
